package com.yds.socket;

public class ReadMe {

    /**
     * 初始化服务端:
     * mSocketServer = new SocketServer();
     * // 绑定activity生命周期，如果不绑定可以主动调用：mSocketServer.stopSocketServer();
     * getLifecycle().addObserver(mSocketServer);
     *
     * 开启服务端：
     * mSocketServer.startSocketServer(6688, new ServerCallback() {
     *             @Override
     *             public void receiveClientMsg(boolean state, String msg) {
     *                 Log.d("Simon", "receiveClientMsg = " + msg);
     *                 if (TextUtils.isEmpty(msg)) return;
     *             }
     *
     *             @Override
     *             public void otherMsg(OtherMsgBean otherMsgBean) {
     *                 switch (otherMsgBean.code) {
     *                     case CodeType.DISCONNECT_SOCKET:
     *                         Log.d("Simon", "otherMsg DISCONNECT_SOCKET = " + otherMsgBean.toString());
     *                         break;
     *                     case CodeType.CONNECT_SOCKET:
     *                         Log.d("Simon", "otherMsg CONNECT_SOCKET = " + otherMsgBean.toString());
     *                         break;
     *                     case CodeType.SUCCESS_MSG:
     *                         Log.d("Simon", "otherMsg SUCCESS_MSG = " + otherMsgBean.toString());
     *                         break;
     *                     case CodeType.ERROR_MSG:
     *                         Log.d("Simon", "otherMsg ERROR_MSG = " + otherMsgBean.toString());
     *                         break;
     *                     case CodeType.EXCEPTION_MSG:
     *                         Log.d("Simon", "otherMsg EXCEPTION_MSG = " + otherMsgBean.toString());
     *                         break;
     *                 }
     *             }
     *
     *         });
     *
     * 关闭服务端：
     * mSocketServer.stopSocketServer();
     *
     * 发送消息：
     * mSocketServer.sendMsgToClient("")
     */

    /**
     * 初始化客户端：
     * mSocketClient = new SocketClient();
     *
     * 连接服务端：
     * mSocketClient.connectSocketServer("192.168.81.102", 6688, new ClientCallback() {
     *             @Override
     *             public void receiveServerMsg(boolean state, String msg) {
     *                 Log.d("Simon", "receiveServerMsg = " + msg);
     *             }
     *
     *             @Override
     *             public void otherMsg(OtherMsgBean otherMsgBean) {
     *                 Log.d("Simon", "otherMsg = " + otherMsgBean.toString());
     *
     *             }
     *         });
     *
     * 断开连接服务端：
     * mSocketClient.disconnectSocketServer();
     *
     * 发送消息：
     * mSocketClient.sendMsgToServer("");
     */
}
